﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TsSite.Master" AutoEventWireup="true" CodeBehind="Completion.aspx.cs" Inherits="TireService.Web.View.ServiceView.Completion" %>

<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1.Export, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <table cellpadding="0" cellspacing="2" border="0">
        <tr>
            <td>
                <img id="imgPacking" alt="" src="~/Images/Medium/gear_ok.png" runat="server" style="width: 32px; height: 32px" />
            </td>
            <td valign="middle">
                <h3><asp:Label ID="lblTaskCompletion" runat="server" Text="Færdigmeld service"></asp:Label></h3>
            </td>
        </tr>
    </table>
    <hr />

    <!-- Javascript of action dropdown list -->
    <script language="javascript" type="text/javascript">

        // Function that handles actions selected in dropdown list
        function ActionClicked() {

            // Get selected action from dropdownlist
            var id = ddlAction.GetValue();

            if (id != null && id != 0) {
         
            }
            else {
                alert('Ingen handling valgt');
            }
        }

    </script>
                
    <table border="0" cellspacing="0" cellpadding="5" width="100%">
        <tr>
            <td style="width:150px">
                <dxe:ASPxComboBox ID="ddlAction" ClientInstanceName="ddlAction" runat="server" Width="150px">
                    <Items>
                        <dxe:ListEditItem Selected="true" Value="0" Text="-- Handling --" />
                    </Items>
                </dxe:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dxe:ASPxButton ID="btnSubmitAction" runat="server" Text="Udfør" AutoPostBack="False" UseSubmitBehavior="False" Width="75px">
                    <ClientSideEvents Click="function(s, e) { ActionClicked(); }" />
                </dxe:ASPxButton>
            </td>
            <td style="width:150px">
                <dxe:ASPxComboBox ID="ddlExport" ClientInstanceName="ddlExport" runat="server" Width="150px">
                    <Items>
                        <dxe:ListEditItem Selected="True" Value="0" Text="Export pdf" />
                        <dxe:ListEditItem Value="1" Text="Export xls" />
                        <dxe:ListEditItem Value="2" Text="Export csv" />
                        <dxe:ListEditItem Value="3" Text="Export rtf" />
                    </Items>
                </dxe:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dxe:ASPxButton ID="btnExport" runat="server" Text="Exporter" OnClick="btnExport_Click" Width="75px" >
                </dxe:ASPxButton>
            </td>
            <td align="right">
                <asp:Label ID="lblView" runat="server" Text="Visning"></asp:Label>
                <asp:DropDownList ID="ddlView" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="ddlView_SelectedIndexChanged">
                    <asp:ListItem Value="0">Grupper efter Lager og Servicebil</asp:ListItem>
                    <asp:ListItem Value="1">Grupper efter Lager og Lagerplads</asp:ListItem>
                </asp:DropDownList>
                &nbsp;
                <asp:Label ID="lblPageSize" runat="server" Text="Antal linjer pr side"></asp:Label>
                <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true">
                    <asp:ListItem Value="10">10</asp:ListItem>
                    <asp:ListItem Value="25">25</asp:ListItem>
                    <asp:ListItem Value="50">50</asp:ListItem>
                    <asp:ListItem Value="100">100</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
    </table>          
    <hr />

    <dxwgv:ASPxGridView ID="gvServiceCompletion" runat="server" ClientInstanceName="gvServiceCompletion" 
        KeyFieldName="ServiceCarScheduleDetailId" Width="100%" AutoGenerateColumns="False" EnableCallBacks="True" 
        oncustomunboundcolumndata="gvServiceCompletion_CustomUnboundColumnData"
        OnRowUpdating="gvServiceCompletion_RowUpdating">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Border BorderWidth="0px" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="False" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} hjulskift)" 
                Text="Side {0} af {1} ({2} hjulskift)" />
        </SettingsPager>
        <SettingsBehavior AllowFocusedRow="false" ConfirmDelete="True" AllowGroup="true" AllowDragDrop="true" />
        <Columns>
            <dxwgv:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True" Text="Færdigmeld" />
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="1">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvServiceCompletion.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewDataColumn FieldName="ScheduleDate" Visible="false" VisibleIndex="2" Caption="Dato">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="CarId" Visible="false" VisibleIndex="2" Caption="CarId">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="CustomerId" Visible="false" VisibleIndex="3" Caption="CustomerId">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="TireSetId" Visible="false" VisibleIndex="4" Caption="TireSetId">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="ContainerId" Visible="false" VisibleIndex="5" Caption="ContainerId">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="TireBrandDropdown" FieldName="FromTireBrandId" Caption="Mærke" VisibleIndex="6">
                <EditFormSettings VisibleIndex="4" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataColumn FieldName="FromTireBrandNote" VisibleIndex="7" Caption="Model variant">
                <EditFormSettings VisibleIndex="5" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="WidthDropdown" FieldName="FromWidth" Caption="Bredde" Visible="false" VisibleIndex="8">
                <EditFormSettings VisibleIndex="6" Visible="True" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="HeightDropdown" FieldName="FromHeight" Caption="Højde." Visible="false" VisibleIndex="10">
                <EditFormSettings VisibleIndex="7" Visible="True" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="SizeDropdown" FieldName="FromSize" Caption="Fælgstr." Visible="false" VisibleIndex="11">
                <EditFormSettings VisibleIndex="8" Visible="True" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="TireSpeedIndexDropdown" FieldName="FromTireSpeedIndexId" Caption="Hastighedsindex" VisibleIndex="11" Visible="false">
                <EditFormSettings VisibleIndex="9" Visible="True" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="TireLoadIndexDropdown" FieldName="FromTireLoadIndexId" Caption="Belastningsindex" VisibleIndex="11" Visible="false">
                <EditFormSettings VisibleIndex="10" Visible="True" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataColumn FieldName="FromLockingBolt" VisibleIndex="5" Caption="Låsebolte" Visible="false">
                <EditFormSettings VisibleIndex="11" Visible="True" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="FromHubCaps" VisibleIndex="5" Caption="Hjulkapsler" Visible="false">
                <EditFormSettings VisibleIndex="12" Visible="True" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="FromRunFlatTire" VisibleIndex="5" Caption="Runflat dæk" Visible="false">
                <EditFormSettings VisibleIndex="13" Visible="True" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="FromRimProtection" VisibleIndex="5" Caption="Kantbeskytter" Visible="false">
                <EditFormSettings VisibleIndex="14" Visible="True" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="RimTypeDropdown" FieldName="FromRimType" Caption="Fælgetype" VisibleIndex="5" Visible="false">
                <EditFormSettings VisibleIndex="14" Visible="True" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataColumn FieldName="FromExtraBolts" VisibleIndex="5" Caption="Ekstra bolte" Visible="false">
                <EditFormSettings VisibleIndex="15" Visible="True" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="FromSocketWrenchSize" VisibleIndex="5" Caption="Topnøgle str." Visible="false">
                <EditFormSettings VisibleIndex="16" Visible="True" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="FromManufactureDate" VisibleIndex="5" Caption="Prod. dato" Visible="false">
                <EditFormSettings VisibleIndex="17" Visible="True" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="ContainerNumber" VisibleIndex="4" Caption="ContainerNumber">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataTextColumn FieldName="ServiceCarDescription" VisibleIndex="4" Caption="Servicebil">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataColumn FieldName="SequenceNumber" VisibleIndex="6" Caption="Sekvensnr">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataTextColumn FieldName="CargoRoomNumber" VisibleIndex="5" Caption="Lagerplads">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="CarBrandDescription" VisibleIndex="6" Caption="Bilmærke">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataColumn FieldName="Model" VisibleIndex="7" Caption="Model">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="RegistrationNumber" VisibleIndex="8" Caption="Reg.nr.">    
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="TireTypeDescription" VisibleIndex="9" Caption="Type">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="TireBrandDescription" VisibleIndex="10" Caption="Dækmærke">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="TireDimensions" UnboundType="String" VisibleIndex="11" Caption="Dimensioner">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="DummyTireSet" VisibleIndex="12" ToolTip="Angiver om dette er et dummy hjulsæt pga. vi endnu ikke har været ude ved kunden og fået hjul med hjem" Caption="Dummy">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
        </Columns>
        <SettingsEditing PopupEditFormModal="false" PopupEditFormHorizontalAlign="Center" PopupEditFormAllowResize="false" Mode="PopupEditForm" PopupEditFormWidth="600px" />
        <Templates>
            <EditForm>
                <div style="text-align: left; padding: 2px">
                    <h4>Afmonteret og lagerført hjulsæt</h4>
                </div>
                <div style="text-align: right; padding: 2px">
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="lblContainer" runat="server" Text="Lager"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblContainerValue" runat="server" Text='<%# Eval("CargoRoomNumber")%>'></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblContainerCargoNumber" runat="server" Text="Pladsnr"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblContainerCargoNumberValue" runat="server" Text='<%# Eval("ContainerNumber")%>'></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblSendMailToCustomer" runat="server" Text="Send email til kunde"></asp:Label>
                            </td>
                            <td>
                                <dxe:ASPxCheckBox ID="cbSendEmail" runat="server">
                                </dxe:ASPxCheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblFromTirePattern" runat="server" Text="Dækmønster"></asp:Label>
                            </td>
                            <td>
                                <table>
                                    <tr>
                                        <td>HF:</td>
                                        <td>VF:</td>
                                        <td>HB:</td>
                                        <td>VB:</td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <dxe:ASPxTextBox ID="txtRF" runat="server" Width="30px">
                                                <MaskSettings Mask="<0..9>.<00..99>" IncludeLiterals="DecimalSymbol" />
                                                <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-IsRequired="true" />
                                            </dxe:ASPxTextBox>
                                        </td>
                                        <td>
                                            <dxe:ASPxTextBox ID="txtLF" runat="server" Width="30px">
                                                <MaskSettings Mask="<0..9>.<0..9>mm" IncludeLiterals="DecimalSymbol" />
                                                <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-IsRequired="true" />
                                            </dxe:ASPxTextBox>
                                        </td>
                                        <td>
                                            <dxe:ASPxTextBox ID="txtRR" runat="server" Width="30px">
                                                <MaskSettings Mask="<0..9>.<0..9>mm" IncludeLiterals="DecimalSymbol" />
                                                <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-IsRequired="true" />
                                            </dxe:ASPxTextBox>
                                        </td>
                                        <td>
                                            <dxe:ASPxTextBox ID="txtLR" runat="server" Width="30px">
                                                <MaskSettings Mask="<0..9>.<0..9>mm" IncludeLiterals="DecimalSymbol" />
                                                <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-IsRequired="true" />
                                            </dxe:ASPxTextBox>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <dxwgv:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                    <table>
                        <tr>
                            <td colspan="2">
                                <asp:Label ID="lblNote" runat="server" Text="Kommentar/note til hjulsæt"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:TextBox ID="txtNote" TextMode="MultiLine" Height="50px" Width="150px" runat="server" Text='<%# Eval("TireSetNote")%>'></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblCargoContainerRoomChanged" runat="server" Text="Ny lager plads"></asp:Label>
                            </td>
                            <td>
                                <dxe:ASPxCheckBox ID="cbCargoContainerRoom" runat="server">
                                </dxe:ASPxCheckBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblCargoContainerRoom" runat="server" Text="Lagerplads"></asp:Label>
                            </td>
                            <td>
                                <dxe:ASPxTextBox ID="txtNewCargoContainerRoom" runat="server" Width="75px">
                                </dxe:ASPxTextBox>
                            </td>
                        </tr>
                    </table>
                </div>
                <div style="text-align: right; padding: 2px">
                    <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                    <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                </div>
            </EditForm>
        </Templates>            
        
        
                                                    
    </dxwgv:ASPxGridView>            
    
    
    
                
    <dxwgv:ASPxGridViewExporter ID="gvExport" runat="server" GridViewID="gvServiceCompletion">
    </dxwgv:ASPxGridViewExporter>
    
</asp:Content>

